﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VehicleScale.Models;

namespace VehicleScale.EntityMappers
{
    public class ConfigMapper
    {
        #region Methods With Relation
        public static ConfigModel ToModel(Config entity)
        {
            if (entity == null) return null;
            ConfigModel model = new ConfigModel()
            {
                EmployeePrefix = entity.EmployeePrefix,
                EmployeeCodeLength = entity.EmployeeCodeLength,
                CustomerPrefix = entity.CustomerPrefix,
                CustomerCodeLength = entity.CustomerCodeLength,
                CategoryPrefix = entity.CategoryPrefix,
                CategoryCodeLength = entity.CategoryCodeLength,
                ProductPrefix = entity.ProductPrefix,
                ProductCodeLength = entity.ProductCodeLength,
                VehicleScaleImPrefix = entity.VehicleScaleImPrefix,
                VehicleScaleImLength = entity.VehicleScaleImLength,
                VehicleScaleExPrefix = entity.VehicleScaleExPrefix,
                VehicleScaleExLength = entity.VehicleScaleExLength,
                VehicleScaleImStart = entity.VehicleScaleImStart,
                VehicleScaleExStart = entity.VehicleScaleExStart
            };

            return model;

        }

        public static Config ToEntity(Config entity, ConfigModel model)
        {
            if (model == null) return null;
            entity.EmployeePrefix = model.EmployeePrefix;
            entity.EmployeeCodeLength = model.EmployeeCodeLength;
            entity.CustomerPrefix = model.CustomerPrefix;
            entity.CustomerCodeLength = model.CustomerCodeLength;
            entity.CategoryPrefix = model.CategoryPrefix;
            entity.CategoryCodeLength = model.CategoryCodeLength;
            entity.ProductPrefix = model.ProductPrefix;
            entity.ProductCodeLength = model.ProductCodeLength;
            entity.VehicleScaleImPrefix = model.VehicleScaleImPrefix;
            entity.VehicleScaleImLength = model.VehicleScaleImLength;
            entity.VehicleScaleExPrefix = model.VehicleScaleExPrefix;
            entity.VehicleScaleExLength = model.VehicleScaleExLength;
            entity.VehicleScaleImStart = model.VehicleScaleImStart;
            entity.VehicleScaleExStart = model.VehicleScaleExStart;
            return entity;
        }
        #endregion

    }
}
